﻿#include "FITKAcousticsMaterialsFiber.h"

namespace Acoustics
{
    FITKAcousticsAbsMaterial::AcousticsMaterialType FITKAcousticsMaterialsFiber::getAcousticsMaterialType()
    {
        return FITKAcousticsAbsMaterial::AcousticsMaterialType::Fiber;
    }

    double FITKAcousticsMaterialsFiber::getFlowResistivity() const
    {
        return _flowResistivity;
    }

    void FITKAcousticsMaterialsFiber::setFlowResistivity(double flowResistivity)
    {
        _flowResistivity = flowResistivity;
    }

    double FITKAcousticsMaterialsFiber::getPorosity() const
    {
        return _porosity;
    }

    void FITKAcousticsMaterialsFiber::setPorosity(double porosity)
    {
        _porosity = porosity;
    }

    double FITKAcousticsMaterialsFiber::getTortuosity() const
    {
        return _tortuosity;
    }

    void FITKAcousticsMaterialsFiber::setTortuosity(double tortuosity)
    {
        _tortuosity = tortuosity;
    }

    double FITKAcousticsMaterialsFiber::getThermalLength() const
    {
        return _thermalLength;
    }

    void FITKAcousticsMaterialsFiber::setThermalLength(double thermalLength)
    {
        _thermalLength = thermalLength;
    }

    double FITKAcousticsMaterialsFiber::getViscousLength() const
    {
        return _viscousLength;
    }

    void FITKAcousticsMaterialsFiber::setViscousLength(double viscousLength)
    {
        _viscousLength = viscousLength;
    }

    double FITKAcousticsMaterialsFiber::getLossFactor() const
    {
        return _lossFactor;
    }

    void FITKAcousticsMaterialsFiber::setLossFactor(double lossFactor)
    {
        _lossFactor = lossFactor;
    }

    bool FITKAcousticsMaterialsFiber::copy(Core::FITKAbstractDataObject *obj)
    {
        //转换强制类型
        Acoustics::FITKAcousticsMaterialsFiber* data = dynamic_cast<Acoustics::FITKAcousticsMaterialsFiber*>(obj);

        if(nullptr == data)//判断是否转换成功
        {
            return false;
        }
        //复制成员变量
        _flowResistivity = data->getFlowResistivity();
        _porosity = data->getPorosity();
        _tortuosity = data->getTortuosity();
        _thermalLength = data->getThermalLength();
        _viscousLength = data->getViscousLength();
        _lossFactor = data->getLossFactor();

        // 调用父类的方法
        Acoustics::FITKAcousticsAbsMaterial::copy(obj);
        return true;
    }
}
